package com.zsh;

import java.io.Serializable;

public class CommonResponse implements Serializable {
    private String version = "1.0";
    private String msg;
    private String code;
    private Object data;

    public CommonResponse(String code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static CommonResponse success(Object data) {
        return new CommonResponse(ResponseCode.CODE_OK, data,null);
    }

    public static CommonResponse exception(Object data, String msg) {
        return new CommonResponse(ResponseCode.CODE_FAIL, data, msg);
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
